package com.bw.z.handler;

import android.os.Handler;
import android.os.Message;

import androidx.annotation.NonNull;

import java.lang.ref.WeakReference;

public class TimerHandler extends Handler {
    private WeakReference<TimerCallBack> weakReference;

    public TimerHandler(TimerCallBack timerCallBack) {
        weakReference = new WeakReference<>(timerCallBack);
    }

    @Override
    public void handleMessage(@NonNull Message msg) {
        super.handleMessage(msg);
        weakReference.get().callBack();
    }

    public interface TimerCallBack {
        void callBack();
    }
}
